package com.Threecharacters.inherit_.ExtendsExercise;

public class ExtendsExercise3 {
    public static void main(String[] args) {

        Computer computer = new Computer("英特尔", 2000, "机械硬盘");

        System.out.println("==PC==");
        PC pc = new PC("华为");
        System.out.println(pc.display());
        System.out.println("==NotePad==");
        NotePad notePad = new NotePad("黑色");
        System.out.println(notePad.display());

    }
}

class Computer {
    String CPU;
    double ram;
    String HardDrive;


    public Computer(String CPU, double ram, String HardDrive) {
        this.CPU = CPU;
        this.ram = ram;
        this.HardDrive = HardDrive;
    }

    public String display() {
        return "CPU: " + CPU + ", ram: " + ram + ", HardDrive: " + HardDrive;
    }
}

class PC extends Computer {
    String Brand;
    public PC(String Brand) {
        super("英特尔", 2000, "机械硬盘");
        this.Brand = Brand;
        System.out.println("品牌是 " + Brand);
    }

}

class NotePad extends Computer {
    String color;

    public NotePad(String color) {
        super("英特尔", 2000, "机械硬盘");
        this.color = color;
        System.out.println("颜色是 " + color);
    }
}











